// user_pkg/pages/wallet/wallet.js
Page({
  data: {
    balance: 0
  },
  onShow() {
    this.getBalance()
  },
  // 获取账户余额
  async getBalance() {
    const res = await wx.http.get('/user/assets')
    const balance = res.data.data.assets.balance
    this.setData({balance})
  },
  // 充值
  toRecharge() {
    wx.navigateTo({
      url: '../recharge/recharge',
    })
  },
  // 前往账单详情
  toBill() {
    wx.navigateTo({
      url: '../bill/bill'
    })
  }
})